import Buff from '@/Buff';
import BuffUtil from '@/BuffUtil';
import BuffCommon from 'code/Core/Common/BuffCommon';
import UnitCommon from 'code/Core/Common/UnitCommon';
import AbilityBase from 'code/Scripts/Abilities/base/AbilityBase';
/**
 * 神圣之光
 **/
export default class QS_HolyLight extends AbilityBase {
    static instance: QS_HolyLight;
    buffType: AppBuffType = {
        id: 'buff_QS_HolyLight',
        art: this.art,
        name: this.abilityName,
        ubertip: '受到持续治疗',
        dur: 6,
        targetAttach: 'origin',
        targetArt: '',
        attribute: {},
        interval: 1,
        onInterval: this.buffInterval.bind(this),
    };
    buffInterval(buff: Buff) {
        let source = buff.getCaster();
        let lv = this.getAbilityLevel(source);
        let dmg = 15 * lv + UnitCommon.取法强(source) * (0.6 + 0.4 * lv);
        DamageSystemInstance.applyDotHeal(buff.getParent(), source, dmg, this.id);
    }
    constructor(id: string) {
        super(id);
        QS_HolyLight.instance = this;
        this.init();
        se.onUnitSpellEffect(this.onSpellEffect.bind(this), this.id);
    }
    init() {
        BuffUtil.registerBuffType(this.buffType);
    }
    cast<T extends Object = any>(tarX: number, tarY: number, source: unit, target: unit, data?: T): void {
        let lv = this.getAbilityLevel(source);
        let dmg = (30 + UnitCommon.取法强(source)) * lv;
        DamageSystemInstance.applyHeal(target, source, dmg, this.id);
        // BuffUtil.addBuff(target, this.buffType.id, source);
        BuffCommon.addBuff({ target, caster: source, buffTypeId: this.buffType.id, ablityId: this.id });
    }
    onSpellEffect() {
        this.cast(GetSpellTargetX(), GetSpellTargetY(), GetTriggerUnit(), GetSpellTargetUnit());
    }
}
